package com.huawei.appmarket.service.appdetail.view.widget;

import android.content.Context;
import android.util.AttributeSet;
import android.widget.ImageView;

public class FixedWidthImageView extends ImageView {
    public FixedWidthImageView(Context context) {
        super(context);
    }

    public FixedWidthImageView(Context context, AttributeSet attributeSet) {
        super(context, attributeSet);
    }

    public FixedWidthImageView(Context context, AttributeSet attributeSet, int i) {
        super(context, attributeSet, i);
    }

    protected void onMeasure(int i, int i2) {
        super.onMeasure(i, i2);
        int intrinsicHeight = getDrawable().getIntrinsicHeight();
        int intrinsicWidth = getDrawable().getIntrinsicWidth();
        if (intrinsicWidth > 0) {
            int measuredWidth = getMeasuredWidth();
            setMeasuredDimension(measuredWidth, (int) (((float) intrinsicHeight) * (((float) measuredWidth) / ((float) intrinsicWidth))));
        }
    }
}
